import Pageable = Api.Common.Pageable;
import Page = Api.Common.Page;
import {request} from '../request';


export function fetchCompanyUserCount(params: {}) {
  return request<number>({
    url: '/company/getUserCountByCompany',
    method: 'post',
    data: params
  });
}

/** 分页查询 */
export function fetchCompanyPage(params?: Pageable) {
  return request<Page<Api.Entity.Company>>({
    url: '/company/page',
    method: 'post',
    data: params
  });
}

export function fetchSaveCompany(params: Api.Entity.Company) {
  return request<Api.Entity.Role>({
    url: '/company/save',
    method: 'post',
    data: params
  });
}

export function fetchDeleteCompany(ids: number[]) {
  return request<Api.Entity.Company>({
    url: '/company/delete',
    method: 'post',
    data: {
      ids: ids
    }
  });
}

export function fetchUpdateCompany(params: Api.Entity.Company) {
  return request<Api.Entity.Company>({
    url: '/company/update',
    method: 'post',
    data: params
  });
}

export function fetchCompanyMenus(companyId: number) {
  return request<Api.SystemManage.Menu[]>({
    url: '/menu/getCompanyMenus/' + companyId,
    method: 'get',
    data: {}
  });
}
